// 定义一些页面公用数据和方法喽
import { ref } from 'vue'
import { getCommunityListApi } from '@/api/owners/member.js'
// 表格数据
export const peopleTable = [
  { value: 'community', label: '小区名称' },
  { value: 'building', label: '栋数' },
  { value: 'house', label: '房产名称' },
  { value: 'name', label: '成员名称' },
  { value: 'photo', label: '照片' },
  { value: 'identity_id', label: '身份证号' },
  { value: 'tel', label: '联系方式' },
  { value: 'birth', label: '生日' },
  { value: 'gender', label: '性别' },
  { value: 'owner_type', label: '成员类型' },
  { value: 'create_time', label: '创建时间' },
  { value: 'occupation', label: '备注' },
]
// 小区名称分类
export const usecommunityList = (type = false) => {
  const communityList = ref([])

  const initData = async () => {
    const { data } = await getCommunityListApi()
    // console.log(data);
    communityList.value = data
    if (type) communityList.value.unshift({ code: 'all', name: '所有小区' })
  }
  onMounted(() => {
    initData()
  })

  return communityList
}

// 性别
export const useGender = () => {
  const list = [
    {
      value: 1,
      label: '男',
    },
    {
      value: 0,
      label: '女',
    }
  ]
  return list
}


export const useType = () => {
  const list = [
    {
      value: 1,
      label: '业主',
    },
    {
      value: 2,
      label: '家庭成员',
    },
    {
      value: 3,
      label: '租客',
    }
  ]

  return list
}






